namespace CampDay20.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class Added_Essay : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Essays",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                        Body = c.String(),
                        DateSubmitted = c.DateTime(nullable: false),
                        Grade = c.Int(nullable: false),
                        StudentId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Students", t => t.StudentId, cascadeDelete: true)
                .Index(t => t.StudentId);
        }

        public override void Down()
        {
            DropForeignKey("dbo.Essays", "StudentId", "dbo.Students");
            DropIndex("dbo.Essays", new[] { "StudentId" });
            DropTable("dbo.Essays");
        }
    }
}